#include "RectLayout.h"
#include "VisibleRect.h"

void RectLayout::AlignToTopLeft(CCSprite* pSprite)
{
	pSprite->setAnchorPoint(cocos2d::CCPoint(0,1));
	pSprite->setPosition(VisibleRect::leftTop());
}

void RectLayout::AlignToTopRight(CCSprite* pSprite)
{
	pSprite->setAnchorPoint(cocos2d::CCPoint(1,1));
	pSprite->setPosition(VisibleRect::rightTop());
}

void RectLayout::AlignToBottomLeft(CCSprite* pSprite)
{
	pSprite->setAnchorPoint(cocos2d::CCPoint(0,0));
	pSprite->setPosition(VisibleRect::leftBottom());
}

void RectLayout::AlignToBottomRight(CCSprite* pSprite)
{
	pSprite->setAnchorPoint(cocos2d::CCPoint(1,0));
	pSprite->setPosition(VisibleRect::rightBottom());
}

void RectLayout::AlignToLeft( CCSprite* pSprite )
{
	pSprite->setAnchorPoint(cocos2d::CCPoint(0,0.5));
	pSprite->setPosition(VisibleRect::left());
}

void RectLayout::AlignToRight( CCSprite* pSprite )
{
	pSprite->setAnchorPoint(cocos2d::CCPoint(1,0.5));
	pSprite->setPosition(VisibleRect::right());
}

void RectLayout::AlignToTop( CCSprite* pSprite )
{
	pSprite->setAnchorPoint(cocos2d::CCPoint(0.5,1));
	pSprite->setPosition(VisibleRect::top());
}

void RectLayout::AlignToBottom( CCSprite* pSprite )
{
	pSprite->setAnchorPoint(cocos2d::CCPoint(0.5,0));
	pSprite->setPosition(VisibleRect::bottom());
}

void RectLayout::AlignToCenter( CCSprite* pSprite )
{
	pSprite->setAnchorPoint(cocos2d::CCPoint(0.5,0.5));
	pSprite->setPosition(VisibleRect::center());
}
